﻿using GroupThreeMESProject.Entity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

using Volo.Abp.Application.Services;

namespace GroupThreeMESProject.Service
{

    [ApiExplorerSettings(GroupName = "v2")]
    public class TestDataService : ApplicationService
    {
        
        private readonly ISqlSugarClient _db;

        public TestDataService(ISqlSugarClient db)
        {
            _db = db;
        }

        [HttpGet("GetDepartmentList")]
        public object GetDepartmentList()
        {
            // 创建一个新的 Student 对象
            Student s = new Student()
            {
                Id = 4,
                Name = "张三4"
            };

            // 插入该对象到数据库
            _db.Insertable(s).ExecuteCommand();

            // 查询所有的学生记录
            List<Student> list = _db.Queryable<Student>().ToList();

            // 返回查询结果
            return list;
        }
       
    }
}
